package com.SparkCore.RDD.Operator.Transform

import org.apache.spark.{SparkConf, SparkContext}

/**
 * 从服务器日志数据中获取用户请求URL资源路径
 */
object Spark01_RDD_Operator_Transform_Test {

  def main(args: Array[String]): Unit = {

    //创建环境
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sparkContext = new SparkContext(sparkConf)

    //创建算子
    val rdd = sparkContext.textFile("datas/1.txt")

    val mapRDD = rdd.map(
      line => {
        val datas = line.split(" ")
        datas(6)
      }
    )

    mapRDD.collect().foreach(println)


    //关闭RDD
    sparkContext.stop()
  }
}
